Repository navigation
host: keep a Session added while remove-agent awaits its archives - #2617
Merged
Merged
Conversation
remove-agent wrote back the Session list it read before awaiting one archive per Session, so a Session added meanwhile was dropped; when every archive succeeded it deleted the record and orphaned that Session. The removal now applies its own archives to the live record and keeps a late Session, asking for a retry instead. Refs #2616
Collaborator
Author
|
Verdict: PASS at 645a9e9 Ran at this tip: Not run: full Scope and review:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written-by: Dev
Owner: Dev
Reviewer: Reviewer
Fixes #2616
remove-agentcopied the DSH Agent's Session list, awaited onearchiveSessionper Session andthen wrote that pre-await copy back (
record(agentId).sessions = kept), so a Session anotherrequest added while it waited was dropped; when every archive succeeded the record was deleted
outright and the new Session was orphaned. The removal now applies its own outcome to the live
record: the kept branch filters out exactly the ids it archived (in
rt.mutate), and theall-archived branch keeps the Sessions the snapshot did not have and answers a retryable error
instead of deleting the record, so nothing is lost and a retry archives that Session.
archiveAgentSession,createAgentSession,adoptAgentSessionandaddAgent's rollback areuntouched; no compare-and-swap, no new endpoint, no UI change.
Ran at this tip: 645a9e9
Not run:
npm run verify(full suite; scoped to the target test),ds-bot-patches.mjs canonicaland
arch-docs(both need git, absent on the dev box;core/andpatches/were keptbyte-identical by
check), smoke bench.Red first: on the unmodified implementation the two new tests fail —
["s2"]instead of["s2","s3"], andok:truewith the record deleted instead of the retryable error.Checkpoint
{
"pr": 2617,
"claim": "Dev",
"issue": 2616,
"summary": "remove-agent no longer writes back the Session list it read before awaiting one archive per Session. The kept branch now filters the ids it actually archived out of the live record, and the all-archived branch keeps any Session added meanwhile and answers a retryable error instead of deleting the record, so a Session added during the removal is never dropped or orphaned. Two tests gate the archive hook and reproduce both interleavings; both were red before the fix.",
"files": [
"core/src/host/agents.js",
"core/test/agents.test.js",
"changelog.d/2616.fixed.md",
"docs/subsystems/core-host.md",
"patches/ds-bot/0001-core-fixes.patch"
],
"checks": { "ran": "node --import ./test/harness-resolve.mjs --test test/agents.test.js; node scripts/ds-bot-patches.mjs check; node .github/scripts/changelog.mjs check; npx oxlint src test; node core/scripts/build-client.mjs --check; node .github/scripts/check-mojibake.mjs --check", "result": "green", "at": "645a9e95cec3a136b4db4f24a280bcb7c0f6c43d" },
"next": "Reviewer: judge the tip for T2/T3. Nothing else pending."
}